package com.shop.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.shop.mapper.Oms_Order_Return_Apply_Mapper;
import com.shop.pojo.oms.Oms_Order_Return_Apply;
import com.shop.service.Oms_Order_Return_Apply_Service;
import com.shop.utils.LayuiUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class Oms_Order_Return_Apply_ServiceImpl
        extends ServiceImpl<Oms_Order_Return_Apply_Mapper, Oms_Order_Return_Apply>
        implements Oms_Order_Return_Apply_Service {

    @Autowired
    private Oms_Order_Return_Apply_Mapper oms_order_return_apply_mapper;


    /**
     * 后台的显示所有退货订单信息
     * @param pages
     * @param ora
     * @return
     */
    @Override
    public LayuiUtils<Oms_Order_Return_Apply> find_admin_order_return_apply_All(Page<Oms_Order_Return_Apply> pages, Oms_Order_Return_Apply ora) {
        LayuiUtils<Oms_Order_Return_Apply> layuiUtils = new LayuiUtils<>();


        QueryWrapper<Oms_Order_Return_Apply> query = new QueryWrapper<>();
        if(ora.getOrder_sn() != null){
            query.like("order_cn",ora.getOrder_sn());
        }
        if(ora.getMember_username() != null){
            query.like("member_username",ora.getMember_username());
        }



        Page<Oms_Order_Return_Apply> oms_order_return_applyPage = oms_order_return_apply_mapper.selectPage(pages, query);
        layuiUtils.setCount(oms_order_return_applyPage.getTotal());
        layuiUtils.setData(oms_order_return_applyPage.getRecords());

        return layuiUtils;
    }
}
